
#include "inside.hpp"
#include <array>
#include <cassert>
#include <fstream>
#include <iostream>
#include <nlohmann/json.hpp>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using json = nlohmann::json;

/**
 * @brief 测试把注释从json文件中删除
 *
 * @return int
 */
int main() {
  ifstream input{"input3.json"};
  stringstream sst;

  string line;
  while (!input.eof()) {
    getline(input, line);
    if (line.find("//") != string::npos) {
      line.erase(line.find("//"));
    }
    if (line.find_first_not_of(' ') != string::npos) {
      cout << line << endl;
      sst << line << "\n";
    }
  }
  // ofstream outs{"string.json"};
  // // sst 调用这个函数后内容就没有了
  // outs << sst.rdbuf() << endl;
  // outs.close();
  // cout << sst.rdbuf();
  // input >> sst;
  json j;
  sst >> j;
  ofstream out{"output.json"};
  out << j.dump(4);
  out.close();
  {
    Input::Inside isd;
    isd.init();
  }
  return 0;
}